import { createApp } from 'vue';
// global css
import 'uno.css';
import '@/assets/styles/index.scss';
import 'element-plus/theme-chalk/dark/css-vars.css';

// App、router、store
import App from './App.vue';
import store from './store';
import router from './router';

// 自定义指令
import directive from './directive';

// 注册插件
import plugins from './plugins/index'; // plugins
import { download } from '@/utils/request';

// 预设动画
import animate from './animate';

// svg图标
import 'virtual:svg-icons-register';
import ElementIcons from '@/plugins/svgicon';

// permission control
import './permission';

import { useDict } from '@/utils/dict';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi';

// 国际化
import i18n from '@/lang/index';
// 生成二维码组件
import QrCode from 'qrcode.vue'
// 图片拖拽排序组件
import draggable from "vuedraggable";
// 富文本
import Editor from "@/components/Editor/index.vue";
// dialog弹框
// import Dialog from "@/components/Dialog/index.vue";
// 也是dialog弹框
import EnteringForm from "@/components/EnteringForm/index.vue";
// 图片预览
import ImagePreview from "@/components/ImagePreview/index.vue";
// 图片上传
import ImageUpload from "@/components/ImageUpload/index.vue";
// 分页
import Pagination from "@/components/Pagination/index.vue";




const app = createApp(App);
// 全局方法挂载
app.config.globalProperties.useDict = useDict;
app.config.globalProperties.getConfigKey = getConfigKey;
app.config.globalProperties.updateConfigByKey = updateConfigByKey;
app.config.globalProperties.download = download;
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.handleTree = handleTree;
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.selectDictLabels = selectDictLabels;
app.config.globalProperties.animate = animate;
//正则校验手机号
app.config.globalProperties.$phoneReg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
//正则校验身份证号
app.config.globalProperties.$idCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/

app.use(ElementIcons);
app.use(router);
app.use(store);
app.use(i18n);
app.use(plugins);
// 自定义指令
directive(app);
// 全局挂载生成二维码
app.component('qr-code',QrCode)
// 全局挂载生成图片拖拽排序
app.component('draggable',draggable)
// 富文本
app.component('Editor',Editor)
// dialog
// app.component('Dialog',Dialog)
// 也是dialog
app.component('EnteringForm',EnteringForm)
// 图片预览
app.component('ImagePreview',ImagePreview)
// 图片上传
app.component('ImageUpload',ImageUpload)
// 分页
app.component('Pagination',Pagination)


app.mount('#app');
